package com.casework

import org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils


class FeedbackController {
    def mailService
    def feedback = {
        //send email
        def conf = SpringSecurityUtils.securityConfig
        def bodyOfEmail = """
        Hello,
        The following feedback has been given on the site:
        Name: ${params.name}
        Email: ${params.email}
        Phone Number: ${params.phoneNumber}
        Feedback:
        ${params.feedback}
        """
        mailService.sendMail {
            to conf.ui.feedback.emailTo
            from conf.ui.register.emailFrom
            subject "Feedback from compRxInsight"
            body bodyOfEmail.toString()
        }
        redirect controller: 'feedback', action:'responseToFeedback'
    }

    def responseToFeedback = {
        render view: 'responseToFeedback'
    }
}
